import request from '@/utils/request'

// 获取所有备份任务
export function getBackupTasks() {
  return request({
    url: '/api/backups',
    method: 'get'
  })
}

// 创建备份任务
export function createBackupTask(data) {
  return request({
    url: '/api/backups',
    method: 'post',
    data
  })
}

// 更新备份任务
export function updateBackupTask(id, data) {
  return request({
    url: `/api/backups/${id}`,
    method: 'put',
    data
  })
}

// 删除备份任务
export function deleteBackupTask(id) {
  return request({
    url: `/api/backups/${id}`,
    method: 'delete'
  })
}

// 执行备份任务
export function executeBackupTask(id) {
  return request({
    url: `/api/backups/${id}/execute`,
    method: 'post'
  })
}

// 获取备份任务详情
export function getBackupTask(id) {
  return request({
    url: `/api/backups/${id}`,
    method: 'get'
  })
}